package com.tomorrow.runner.test;

import android.content.Context;
import android.database.Cursor;

import com.tomorrow.runner.data.model.ActivityDataModel;

import cn.sucun.android.log.Log;

/**
 * Created by tomorrow on 16-5-6.
 */
public class DBUtil {
    public static void showTable(Context context){
        Cursor c = context.getContentResolver().query(ActivityDataModel.getContentUri(), null, null, null, null);
        if (c != null && c.getCount() > 0){
            if (c.moveToFirst()){
                do{
                    int indexOfID = c.getColumnIndexOrThrow(ActivityDataModel.ACTIVITY_ID);
                    int indexOfType = c.getColumnIndexOrThrow(ActivityDataModel.DATA_TYPE);
                    int indexOfData = c.getColumnIndexOrThrow(ActivityDataModel.PRIMARY_DATA);

                    Log.i("DBUtil","A_ID="+c.getInt(indexOfID));
                    Log.i("DBUtil","TYPE="+c.getInt(indexOfType));
                    Log.i("DBUtil","DATA="+c.getString(indexOfData));
                }
                while (c.moveToNext());
            }
            c.close();
        }
    }
}
